package com.example;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.DeclareParents;
import org.aspectj.lang.annotation.Pointcut;

/**
 * @ClassName MyAspect
 * @Description
 * @Author Yin
 * @Date 2021/4/11 23:31
 * @Version 1.0
 */
@Aspect
public class MyAspect {
    @Pointcut("execution(* com.example.*.*(..))")
    public void pointCut(){};

    @DeclareParents(
            value = "com.example.UserServiceImpl",
            defaultImpl = UserValidatorImpl.class
    )
    public UserValidator userValidator;

    @Before("pointCut()")
    public void before(){
        System.out.println("before");
    }
}
